package gui.edit.listeners;

import gui.edit.components.dialogs.JDialogFillParam;
import gui.edit.enums.E_EditParamsSliders;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import controls.DataControl;
import controls.edit.ParamControl;

/**
 * @author Charles Perin
 * 29 mars 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 *
 */
public class ListenerFillButton implements ActionListener{

	private ParamControl paramControl;
	private E_EditParamsSliders editParam;

	public ListenerFillButton(ParamControl paramControl, E_EditParamsSliders editParam){
		this.paramControl=paramControl;
		this.editParam=editParam;
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		if(paramControl.getParamsControl().getDisplayDataList().isSelecting()){
			DataControl dataControl = paramControl.getParamsControl().getDisplayDataList().getDataControl();
			JDialogFillParam dial = new JDialogFillParam(dataControl.getIhm(), "Fill "+paramControl.getDisplayDataControl().getName(), false, paramControl, editParam);
			dial.setLocationRelativeTo(dataControl.getIhm());
			dial.setVisible(true);
			dataControl.getIhm().setEnabled(false);
		}
	}
}
